package com.nimitz.notice.service.serviceImpl;

import com.nimitz.notice.domain.DictData;
import com.nimitz.notice.domain.Notice;
import com.nimitz.notice.mapper.NoticeMapper;
import com.nimitz.notice.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {

    @Autowired
    private NoticeMapper noticeMapper;

    //查询公告

    @Override
    public List<Notice> getNoticesForPagination(Notice notice) {
//        PageHelper.startPage(page, size);
        return noticeMapper.selectNoticesForPagination(notice);
    }

    @Override
    public Notice selectNoticeById(Long noticeId) {
        return noticeMapper.selectNoticeId(noticeId);
    }

    //添加公告
    @Override
    public void addNotice(Notice notice) {
        noticeMapper.insertNotice(notice);
    }

    @Override
    public void updateNotice(Notice notice) {
        noticeMapper.updateNotice(notice);
    }

    @Override
    public void deleteNotice(Long noticeId) {
        noticeMapper.deleteNotice(noticeId);
    }

    @Override
    public List<DictData> getAllDictData() {
        return noticeMapper.getAllDictData();
    }
}
